////
/// Global reset
/// Based on normalize.css
////

///
/// Document
html {
  font-family: sans-serif;
  font-size: 62.5%;
  font-display: swap;
  line-height: 1;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  box-sizing: border-box;

  *,
  *::after,
  *::before {
    box-sizing: inherit;
  }
}

@viewport {
  width: device-width;
}

:root {
  tab-size: 2;
}

html,
button,
input,
optgroup,
select,
textarea {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
}

///
/// Links
a {
  text-decoration: none;
  background: transparent;

  &:hover,
  &:active {
    outline: 0;
  }
}

a:focus,
[tabindex]:focus {
  outline: none;
}

///
/// Typography
h1,
h2,
h3,
h4,
h5,
h6,
li,
ol,
p,
ul {
  margin: 0;
  padding: 0;
  font-weight: 400;
  font-style: normal;
}

strong {
  font-weight: bolder;
}

small {
  font-size: 80%;
}

sub,
sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

blockquote {
  margin: 0;
}

abbr[title] {
  text-decoration: underline dotted;
}

summary {
  display: list-item;
}

///
/// Lists
ol,
ul {
  list-style: none;

  nav & {
    list-style-image: none;
  }
}

li {
  list-style: none;
}

// Avoid 300ms click delay on touch devices that support 'touch-action'
a,
area,
button,
input,
label,
select,
summary,
textarea,
[role='button'] {
  touch-action: manipulation;
}

///
/// Embedded Content
img {
  max-width: 100%;
  height: auto;
  border: 0;
}

img,
svg {
  display: block;
  vertical-align: middle;
}

///
/// Grouping Content
figure {
  margin: 0;
}

hr {
  box-sizing: content-box;
  height: 0;
}

pre {
  margin-top: 0;
  margin-bottom: 0;
  overflow: auto;
}

code,
kbd,
samp,
pre {
  font-family: monospace;
  font-size: 1em;
}

///
/// Forms
button,
input,
optgroup,
select,
textarea {
  margin: 0;
  padding: 0;
  font-family: inherit;
  line-height: 1;
  color: inherit;
}

button {
  overflow: visible;
}

button,
select {
  text-transform: none;
}

button,
[role='button'],
input[type='button'],
input[type='reset'],
input[type='submit'] {
  -webkit-appearance: button; // stylelint-disable-line property-no-vendor-prefix
  cursor: pointer;
}

input[disabled],
button[disabled] {
  cursor: default;
}

button::-moz-focus-inner,
[type='button']::-moz-focus-inner,
[type='reset']::-moz-focus-inner,
[type='submit']::-moz-focus-inner {
  padding: 0;
  border-style: none;
}

button:-moz-focusring,
[type='button']:-moz-focusring,
[type='reset']:-moz-focusring,
[type='submit']:-moz-focusring {
  outline: 0.1rem dotted ButtonText;
}

input {
  line-height: normal;
}

input[type='radio'],
input[type='checkbox'] {
  box-sizing: border-box;
  padding: 0;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none; // stylelint-disable-line property-no-vendor-prefix
  margin: 0;
  height: auto;
}

input[type='search'] {
  -webkit-appearance: textfield; // stylelint-disable-line property-no-vendor-prefix
  outline-offset: -0.2rem;
}

input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none; // stylelint-disable-line property-no-vendor-prefix
}

::-webkit-file-upload-button {
  -webkit-appearance: button; // stylelint-disable-line property-no-vendor-prefix
  font: inherit;
}

fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

legend {
  border: 0;
  padding: 0;
}

progress {
  vertical-align: baseline;
}

textarea {
  overflow: auto;
}

optgroup {
  font-weight: bolder;
}

select {
  -webkit-appearance: none; // stylelint-disable-line property-no-vendor-prefix
  -moz-appearance: none; // stylelint-disable-line property-no-vendor-prefix
  cursor: pointer;
}

button,
input,
select,
textarea {
  outline: none;
  background: none;
  border: none;
  border-radius: 0;
}

[tabindex='-1']:focus {
  // prevent focus outline on elements that cant be accessed via keyboard
  // remove red border for invalid entries
  outline: none !important; // stylelint-disable-line declaration-no-important
}

select:focus {
  outline: 0;
}

input,
input:focus,
input:invalid,
button:focus {
  box-shadow: none;
}

/* stylelint-disable selector-no-vendor-prefix */
::-webkit-input-placeholder {
  box-shadow: none;
}

::-moz-placeholder {
  box-shadow: none;
  opacity: 1;
}

:-ms-input-placeholder {
  box-shadow: none;
}
/* stylelint-enable selector-no-vendor-prefix */

///
/// Tables
table {
  border-collapse: collapse;
  border-spacing: 0;
}

td,
th {
  padding: 0;
}
